<?php
namespace haibao\cms\data\attendance;

Class AttendanceApproved extends \haibao\cms\data\BaseMysql{

	public function __construct(){
		parent::__construct('\haibao\cms\model\data\attendance\AttendanceApproved');
	}

	public function delApprovedAttendance($jobNum,$endDate){
		
		$sql = 'delete from AttendanceApproved where JobNum=%s and AttendanceCyc=%s';
		$this->query($sql,array($jobNum,$endDate));
		
		$sql = 'delete from AttendanceStatistics where JobNum=%s and AttendanceCycle=%s';
		$this->query($sql,array($jobNum,$endDate));
	}
	
	public function getApprovedRecordByJobNumAndCycle($jobNum,$date){

		$sql = 'select Id from AttendanceApproved where JobNum=%s and AttendanceCyc=%s';
		return $this->query($sql,array($jobNum,$date))->fetch_assoc();
	}
}